package main

import (
	"flag"
	"fmt"
	"strings"

	"goweb/ext/settings"
	"goweb/ext/setup"
	"goweb/models/auth"
)

func SyToTable() {

	cfg := flag.String("c", "src/goweb/conf/config.json", "configuration file")
	flag.Parse()
	setup.SetUp(*cfg)
	conf.MasterDB.Sync2(new(auth.User))
	conf.MasterDB.Sync2(new(auth.Role))
	conf.MasterDB.Sync2(new(auth.UserRole))
	conf.MasterDB.Sync2(new(auth.RolePer))
	conf.MasterDB.Sync2(new(auth.Permission))
	conf.MasterDB.Sync2(new(auth.UserPer))
	conf.MasterDB.Sync2(new(auth.UserSource))
	conf.MasterDB.Sync2(new(auth.Source))
	//conf.MasterDB.Sync2(new(murllook.UrlLook))
	//conf.MasterDB.Sync2(new(murllook.CheckResult))
	//conf.MasterDB.Sync2(new(murllook.CheckResultLog))
	//conf.MasterDB.Sync2(new(murllook.CronTask))
	//conf.MasterDB.Sync2(new(murllook.CronTaskUrlRel))

	//conf.MasterDB.Sync2(new(model.CronTime))
	//conf.MasterDB.Sync2(new(model.Client))
	//conf.MasterDB.Sync2(new(model.Server))
}

func main() {
	SyToTable()

	a := "/api/v1/test?token=ey"
	ft := strings.Split(a, "?")
	fmt.Println(ft[0])
}
